﻿Imports System.Xml.Serialization
Imports System.IO

Public Class TRXSerializer

    Public Shared Function DESSerialize(ByVal _pathTRX As String) As TestRun

        Dim serializer As XmlSerializer = New XmlSerializer(GetType(TestRun))
        Dim tr As TextReader = New StreamReader(_pathTRX)
        Dim test As TestRun = CType(serializer.Deserialize(tr), TestRun)
        tr.Close()

        Return test

    End Function

    Public Shared Sub Serialize(ByVal test As TestRun, ByVal _pathTRX As String)

        Dim serializer As XmlSerializer = New XmlSerializer(GetType(TestRun))
        Dim tw As TextWriter = New StreamWriter(_pathTRX)
        serializer.Serialize(tw, test)
        tw.Close()

    End Sub

End Class
